<?php

abstract class PlatformType {
  
  const windows = "Windows";
  const linux   = "Linux";
}


class GlobalsClass {
	
	//private static $platform = "Linux";
	//private static $platform = "Windows";
  private static $platform = PlatformType::windows;
  /*
  private static $platform = PlatformType::linux;
	
	////////////////////////////////
	/////// FOR UTK SERVER /////////
	private static $pathImgRecon = "/home/jfrank3/www-home/imagerecon/";
	////// paths are relative to $pathImgRecon (must concat to get full path) /////
  // Fiji-related stuff
	private static $fiji_macro_path = "_OTHER/ImageJ/Fiji/macros/";
	private static $fiji_name       = "fiji-linux64";  // The name of the executable in my home area 
	private static $fiji_path       = "_OTHER/ImageJ/Fiji/";
	private static $images_path     = "_Images/";
	private static $img_path_rel_to_applet = "../../../_Images/";
	private static $macro_arg_delim = "@";
       // note for fiji_applet_path: don't append this path to pathImgRecon, just use this as the full path
  private static $fiji_applet_path = "/~jfrank3/imagerecon/_OTHER/ImageJ/Applet_Self_Signed";
     // the url of the method of the jobs controller that handles the Ajax Fiji launch button press
  private static $fijiAjaxLauncherUrl = '/~jfrank3/imagerecon/index.php/jobs/fijiAjaxLaunch';
  
  // Elfinder-related stuff
  private static $elfinder_root_path = "_Images";
  private static $elfinder_root_url  = 'https://web.eecs.utk.edu/~jfrank3/imagerecon/_Images/';
      // note for elfinder_connector_path: don't append this path to pathImgRecon, just use this as the full path
  private static $elfinder_connector_path = '/~jfrank3/imagerecon/webroot/js/libs/Elfinder1.2/connectors/php/connector.php'; 
  
  // FirePHP
  private static $firePHPcore_path  = "_OTHER/FirePHPCore/FirePHP.class.php";
  private static $firePHP_enabled   = false;
  // XML
  private static $jobSchemaFile  = "_OTHER/XML/job_experimental.xsd";
  private static $xmlJobSavePath = "_OTHER/XML/JobData/";
    
  private static $privateKeyFullPath = '/home/jfrank3/.ssh/imagerecon_key';  // ssh private key 
    
  // Path to CakePHP's core files (cake's library files, not my 'app' files).  Needed in webroot/index.php, etc.
	private static $cakeCoreIncludePath = "/home/jfrank3/webhome/imagerecon/CakePHP_def";

  private static $cudaMachineToLogInto = "cudahead.eecs.utk.edu";
  
  private static $job_group_path = "_Images/Jobs";
  private static $preview_dir_name = "PreviewDir";
  */
	

	///////////////////////////////////
	/////// FOR HOME DESKTOP  /////////
	private static $pathImgRecon = "D:\\My Documents\\My Dropbox\\School\\PILOT\\_htdocs\\imagerecon\\";	

	///// PATHS ARE RELATIVE TO $pathImgRecon (must concat to get full path) /////
	// Fiji-related stuff
  private static $fiji_macro_path = "_OTHER\\ImageJ\\Fiji\\macros\\";
	private static $fiji_name       = "fiji-win64";
	private static $fiji_path       = "_OTHER\\ImageJ\\Fiji\\";
	private static $images_path     = "_Images\\";
	private static $img_path_rel_to_applet = "../../../_Images/";
	private static $macro_arg_delim = "@";
     // note for fiji_applet_path: don't append this path to pathImgRecon, just use this as the full path
  private static $fiji_applet_path = "/imagerecon/_OTHER/ImageJ/Applet_Self_Signed";
     // the url of the method of the jobs controller that handles the Ajax Fiji launch button press
  private static $fijiAjaxLauncherUrl = '/imagerecon/index.php/jobs/fijiAjaxLaunch';
  
	// Elfinder-related stuff
  private static $elfinder_root_path = "_Images";
  private static $elfinder_root_url  = 'http://localhost/imagerecon/_Images/';
     // note for elfinder_connector_path: don't append this path to pathImgRecon, just use this as the full path
  private static $elfinder_connector_path = "/imagerecon/webroot/js/libs/Elfinder1.2/connectors/php/connector.php";
  
  
  // FirePHP
  private static $firePHPcore_path  = "_OTHER\\FirePHPCore\\FirePHP.class.php";
  private static $firePHP_enabled   = true;
  // XML
  private static $jobSchemaFile  = "_OTHER\\XML\\job_experimental2.xsd";
  private static $xmlJobSavePath = "_OTHER\\XML\\JobData\\";
  // ssh private key
      // note for privateKeyFullPath: don't append this path to pathImgRecon, just use this as the full path  
  private static $privateKeyFullPath = 'D:\\My Documents\\My Dropbox\\School\\PILOT\\_htdocs\\imagerecon\\imagerecon_key';  
  
  // Path to CakePHP's core files (cake's library files, not my 'app' files).  Needed in webroot/index.php, etc.
	private static $cakeCoreIncludePath = "D:\\My Documents\\My Dropbox\\School\\PILOT\\_htdocs\\imagerecon\\CakePHP_def";

  private static $cudaMachineToLogInto = "cudahead.eecs.utk.edu";
  
  private static $job_group_path = "_Images\\JobGroups";
  private static $preview_dir_name = "PreviewDir";
  
  // <editor-fold defaultstate="collapsed" desc="vars before changing dir structure 8/19/11">  
            //  ///// PATHS ARE RELATIVE TO $pathImgRecon (must concat to get full path) /////
            //	// Fiji-related stuff
            //  private static $fiji_macro_path = "ImageJ\\Fiji\\macros\\";
            //	private static $fiji_name       = "fiji-win64";
            //	private static $fiji_path       = "ImageJ\\Fiji\\";
            //	private static $images_path     = "Images\\";
            //	private static $img_path_rel_to_applet = "../../Images/";
            //	private static $macro_arg_delim = "@";
            //	// Elfinder-related stuff
            ////  private static $elfinder_root_path = "Elfinder1.2\\files";
            ////  private static $elfinder_root_url  = 'http://localhost/imagerecon/Elfinder1.2/files/';
            //  // TEMP:
            //  private static $elfinder_root_path = "Images";
            //  private static $elfinder_root_url  = 'http://localhost/imagerecon/Images/';
            //  
            //  
            //  // FirePHP
            //  private static $firePHPcore_path  = "FirePHPCore\\FirePHP.class.php";
            //  private static $firePHP_enabled   = true;
            //  // XML
            //  private static $jobSchemaFile  = "XML\\job_experimental2.xsd";
            //  private static $xmlJobSavePath = "XML\\JobData\\";
            //  
            //  private static $privateKeyFullPath = '/home/jfrank3/.ssh/imagerecon_key';  // ssh private key
  // </editor-fold>
  
  
  ///////////////////////////////////
	/////// FOR LAPTOP   //////////////
//	private static $pathImgRecon = "C:\\Users\\Jason\\Dropbox\\School\\PILOT\\_htdocs\\imagerecon\\";
  // Path to CakePHP's core files (cake's library files, not my 'app' files).  Needed in webroot/index.php, etc.
//	private static $cakeCoreIncludePath = "C:\\Users\\Jason\\Dropbox\\School\\PILOT\\_htdocs\\imagerecon\\CakePHP_def";
     ///// PATHS ARE RELATIVE TO $pathImgRecon (must concat to get full path) /////
   


	//////////////////////////////////////
	////// FOR ANY SERVER ////////////////
  public static function getImgReconPath()  { return self::$pathImgRecon;   }
  
	public static function getFijiMacroPath() { return self::$pathImgRecon . self::$fiji_macro_path;  }
			//public static function getFijiName()      { return self::$fiji_name;   }
			//public static function getFijiPath()      { return self::$pathImgRecon . self::$fiji_path;   }
	
	public static function getFijiNameWithPath() {
		
		switch (self::$platform) {
      case PlatformType::linux:  // don't wrap exec statment in quotes in Linux!
				return self::$pathImgRecon . self::$fiji_path . self::$fiji_name;
				break;
      case PlatformType::windows: // Wrap exec statment in quotes in Windows!
				return("\"" . self::$pathImgRecon . self::$fiji_path . self::$fiji_name ."\"");
				break;
			default:
				die("\nError in GlobalsClass: switch statement reached default!\n");
		}
	} /////////// end getFijiNameWithPath() ///////
  // Fiji/ImageJ related
	public static function getImagesPath()    { return self::$pathImgRecon . self::$images_path;   }
	public static function getImgPathRelToApplet() { return self::$img_path_rel_to_applet;   }
	public static function getMacroArgDelim() {      return self::$macro_arg_delim;   }
       // note: for getFijiSignedAppletFullPath(), don't prepend any extra path! 
  public static function getFijiSignedAppletFullPath() { return self::$fiji_applet_path; }
  public static function getFijiAjaxLauncherUrl()      { return self::$fijiAjaxLauncherUrl; } 
  
	// Elfinder-related
  public static function getElfinderRootPath() { return self::$pathImgRecon . self::$elfinder_root_path; }
  public static function getElfinderRootURL()  { return self::$elfinder_root_url;  }
  public static function getElfinderConnectorPath()  { return self::$elfinder_connector_path;  }
  // FirePHP
  public static function getFirePHPcore_path() { return self::$pathImgRecon . self::$firePHPcore_path; }
  public static function getFirePHP_enabled()  { return self::$firePHP_enabled; }
  // XML
  public static function getJobSchemaFile()    { return self::$pathImgRecon . self::$jobSchemaFile; }
	public static function getXmlJobSavePath()   { return self::$pathImgRecon . self::$xmlJobSavePath; }
	
  public static function getPlatform()         { return self::$platform; }
        // note: for getPrivateKeyFullPath(), don't prepend any extra path! 
  public static function getPrivateKeyFullPath() { return self::$privateKeyFullPath; }
	
  public static function getCakeCoreIncludePath() { return self::$cakeCoreIncludePath; }
  
  public static function getCudaMachineToLogInto() { return self::$cudaMachineToLogInto; }
  
  public static function getJobGroupFullPath() { return self::$pathImgRecon . self::$job_group_path; }
  
  public static function getPreviewDirFullPath()  { return $this->getJobGroupFullPath() . DS . $preview_dir_name; } 
  public static function getPreviewDirName()      { return self::$preview_dir_name; } 
	
} ////////////// end class ///////////////////////////////////////////


/* -------------------------------------------------------------------------------------
 * ----------------------------- NOTES SECTION -----------------------------------------
 * 
 * Here's a helpful List of Files that 'require_once' this globals_class.php file.
 * This list is important because each of these files must specify a path to the 
 * GlobalsClass file.  Thus if you are changing from one server to another, many
 * times the absolute path specified in the 'require_once' statement must be 
 * modified to work on the new server.  Right now this list is only a helpful
 * start and may not include every such file.
 * 
 * "connector.php" - part of the Elfinder package.  Currently this is under webroot/js/libs/Elfinder1.2/connectors/php/
 * "jobs_controller.php" - see update below
 * "index.php" - under webroot/
 * [whichever view file uses Fiji/ImageJ applet and/or uses the backend Fiji macro scripts]
 * possibly: [whichever files use Elfinder, and thus specify a 'connector' path in a js file]
 * 
 * UPDATE: I am now using CakePHP's App::import() functionality, and thus
 *   it seems not necessary to edit the paths in some of the above-mentioned files.  
 *   However, it seems that files in the "webroot" directory cannot use App::import(),
 *   nor can they use other things like "bootstrap.php".  Basically I think the webroot
 *   dir is walled-off from the rest of the app in some ways.  Thus, for the files
 *   in webroot, manual adjustments to paths to find globals_class.php are necessary.
 * 
 * -------------------------------------------------------------------------------------------
 * Other files that may need manual adjustments to string literals (typically paths) are ones
 * like javascript files that I have not yet found a clean way to include this GlobalsClass file
 * in.  Therefore, these files may require manual adjustments:
 * 
 * [any js file that initializes the Elfinder file explorer] : the ".elfinder()" method must
 *    specify a url of it's "connector.php".
 * 
 * --------------------------------------------------------------------------------------------
 * BASIC STEPS OF CHANGES TO FILES TO MAKE WHEN COPYING EVERYTHING FROM HOME TO UTK SERVER:
 *  1. Change path in:
 *      a. Elfinder javascript files - path to connector. I THINK THIS IS SOLVED NOW - I'm passing a php var to js var
 *      b. Elfinder connector.php and possibly connector.class.php (path to GlobalsClass)
 *  2. globals_class.php:  Change server over to UTK
 *  3. database.php:  change database name and password to UTK's
 *  4. Database schema (if any changes made)
 *       a. also insert enum table vals (if created entire new schema) using SQL script.
 *              (if the enum val script not included in the script that makes entire database)
 * 
 * 
 */

?>